#include "stdafx.h"

CMoveList::CMoveList()
{
}
CMoveList::~CMoveList()
{
}
uint CMoveList::Reset()
{
    cur = size = 0;
    return 0;
};

uint CMoveList::Start()     { cur = 0; return 0; };
uint CMoveList::IsEmpty()   { return (cur >= size); };

uint CMoveList::Add( uint move, int value )
{
    list[size].move     = move;
    list[size].value    = value;
    size++;
    return size;
};

uint CMoveList::Next()
{
    if ( cur < size )
        return list[cur++].move;
    else return NN;
};
uint CMoveList::Pick()
{
    // todo
    return 0;
};

uint CMoveList::PrintMove( uint move )
{
    uint from = BYTE_FROM_UINT( move, 1 );
    uint to   = BYTE_FROM_UINT( move, 0 );
    uint kill = BYTE_FROM_UINT( move, 2 );
    uint pro  = BYTE_FROM_UINT( move, 3 );
    cout << SQ_NAME64[ MAILBOX[ from ] ] << SQ_NAME64[ MAILBOX[ to ] ];
    //if ( kill ) cout << " "<<kill;
    //if ( pro  ) cout << " "<<pro;
    return 0;
}

uint CMoveList::Print()
{
    uint ptr = 0;
    while( ptr < size ){
        cout << "  "<< ptr << "=";
        PrintMove( list[ptr].move );
        ptr++;
    }
    cout << endl;
    return 0;
};